import {View, Text, StyleSheet, TouchableOpacity, Image} from 'react-native'
import React, {Component} from 'react'
import styles, {HUNDRED_PERCENT, rectWithSize} from "../../../../style";
import {AlertButtonStyle, alertProxy} from "../../../common/AlertProxy";
import {Actions} from "react-native-router-flux";
import {defaultObj} from "../../../../util";

interface BackBtnProps {

}

interface BackBtnState {

}


export default class BackBtn extends Component<BackBtnProps, BackBtnState> {


    constructor(props: BackBtnProps) {
        super(props);
    }

    giveUpPay() {
        alertProxy(null, "确定放弃支付?", [{
            text: "离开",
            onPress: () => {
                Actions.pop();
                Actions.refresh({enterTime:new Date()});
            },
            style: AlertButtonStyle.destructive
        }, {
            text: "继续支付",
            onPress: () => {
            },
        }]);
    }

    render() {
        return (<TouchableOpacity style={BackBtnStyle.container} onPress={this.giveUpPay}>
            <Image style={[{marginTop:1},rectWithSize(20)]} source={require("../../../../assets/img/close.png")}/>
        </TouchableOpacity>)
    }
}

const BackBtnStyle = StyleSheet.create({
    container: {
        paddingHorizontal: 18,
        justifyContent: "center",
        height:HUNDRED_PERCENT
    }
});

 